// Copyright (c) 2024, json_wang and contributors
// For license information, please see license.txt

frappe.ui.form.on("AC_BalanceSheet", {
    refresh(frm) {
        frm.add_custom_button('生成报表', () => {
            frm.call('build_report', { throw_if_missing: true })
                .then(r => {
                    frappe.msgprint("生成成功!");
                })
        });  
        frm.set_query("config_version", function (doc, cdt, cdn) {            
            return {
                "filters": {
                    "company": ["=",frm.doc.company]
                }
            };
        });      
    },
});
